<?php $search = \application\Comm\Request::postParam('search');use application\Comm\Func;?>
<div class="bjui-pageHeader">
    <form id="pagerForm" data-toggle="ajaxsearch" action="/article/index.html" method="post">
        <input type="hidden" name="pageSize" value="3">
        <input type="hidden" name="pageCurrent" value="1">
        <input type="hidden" name="orderField" value="id">
        <input type="hidden" name="orderDirection" value="2">
        <div class="bjui-searchBar">
            <label>ID：</label><input type="text" name="search[id]" value="<?php echo isset($search['id'])?$search['id']:''?>" />
            <label>名称：</label><input type="text" name="search[name]" value="<?php echo isset($search['name'])?$search['name']:''?>" /></li>
            <label>分类：</label>
            <select name="search[category_id]" data-toggle="selectpicker" value="<?php echo isset($search['category_id'])?$search['category_id']:''?>" data-width="100">
                <option value="">请选择</option>
                <?php foreach($category as $k => $v){?>
                    <option <?php if($search['category_id']==$k)echo 'selected="selected"';?> value="<?php echo $k?>"><?php echo $v?></option>
                <?php }?>
            </select>
            <button type="submit" class="btn-default" data-icon="search">查询</button>
            <div class="pull-right">
                <a class="btn btn-default" id="article_select_all" href="javascript:;">全选</a>
                <div class="btn-group">
                    <button type="button" class="btn-default dropdown-toggle" data-toggle="dropdown" data-icon="copy">功能操作<span class="caret"></span></button>
                    <ul class="dropdown-menu right" role="menu">
                        <li><a href="<?php echo Func::createUrl('article/create',[])?>" data-toggle="dialog" data-width="1000" data-height="600" data-id="dialog-mask" data-mask="true"><i class="fa fa-plus"></i> 新增数据</a></li>
                        <li><a href="<?php echo Func::createUrl('article/deleteall',['id'=>'{#bjui-selected}'])?>" data-toggle="doajax"  data-confirm-msg="确定要删除选中项吗？"><i class="fa fa-remove"></i> 批量删除</a></li>
                        <li><a href="<?php echo Func::createUrl('article/export',['id'=>'{#bjui-selected}'])?>" data-toggle="doexport"  data-confirm-msg="确定要导出选中项吗？"><i class="fa fa-download"></i> 选择导出</a></li>
                        <li><a href="<?php echo Func::createUrl('article/export',['id'=>'all'])?>" data-toggle="doexport"  data-confirm-msg="确定要导出全部项吗？"><i class="fa fa-download"></i> 全部导出</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </form>
</div>


<div class="bjui-pageContent" id="article_content">

    <!-- 内容区 -->
    <table data-toggle="tablefixed" data-width="100%" data-nowrap="true" data-selected-multi="true">
        <thead>
        <tr>
            <?php foreach($attribute as $key => $val){?>
                <th data-order-field="<?php echo $key?>"><?php echo $val?></th>
            <?php }?>
            <th width="150">操作</th>
        </tr>
        </thead>

        <?php foreach($articles as $keys => $vals){?>
            <tr data-id="<?php echo $vals['id']?>">
                <?php foreach($attribute as $k => $v){?>
                    <td>
                        <?php echo $vals[$k]?>
                    </td>
                <?php }?>
                <td>
                    <a href="<?php echo Func::createUrl('article/create',['id'=>$vals['id']])?>" class="btn btn-green" data-toggle="dialog" data-width="1000" data-height="600" data-id="dialog-mask" data-mask="true">查看</a>
                    <a href="<?php echo Func::createUrl('article/edit',['id'=>$vals['id']])?>" class="btn btn-blue" data-toggle="dialog" data-width="1000" data-height="600" data-id="dialog-mask" data-mask="true">编辑</a>
                    <a href="<?php echo Func::createUrl('article/delete',['id'=>$vals['id']])?>" class="btn btn-red" data-toggle="doajax" data-confirm-msg="确定要删除该行信息吗？">删除</a>
                </td>
            </tr>
        <?php }?>

    </table>
</div>
<?php $this->renderPartial('/common/page',['page'=>$page]); ?>
<script>
    $("#article_select_all").click(function(){

        $("#article_content table tbody tr[data-id]").click()

    });
</script>
